package com.solidtrust.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.solidtrust.entity.Area;

public interface AreaRepository extends JpaRepository<Area, Integer>{

	@Query("from Area a where a.type in (1, 2) order by a.parent, a.id")
	public List<Area> getProvinceAndCities();
	
	@Query("select a2.nameOfGanji from Area a1, Area a2 where a1.id = ? and a1.parent = a2.parent")
	public List<String> getCitiesInSameProvince(int cityId);
}
